﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace StoneStorage.Test
{
    [TestClass]
    public class FilterTest
    {
        [TestMethod]
        public void FilterZiroOutTest()
        {
            Filter filter = new Filter();
            filter.StoneId = 1;
            filter.ProducerId = 2;
            filter.Length = 3;
            filter.Width = 4;
            filter.Height = 5;

            filter.FilterZiroOut();

            Assert.IsNull(filter.StoneId);
            Assert.IsNull(filter.ProducerId);
            Assert.IsNull(filter.Length);
            Assert.IsNull(filter.Width);
            Assert.IsNull(filter.Height);
        }

        [TestMethod]
        public void CreateFilterStringTest1()
        {
            Filter filter = new Filter();
            filter.StoneId = 1;
            filter.ProducerId = 2;
            filter.Length = 3;
            filter.Width = 4;
            filter.Height = 5;

            string s = filter.CreateFilterString();

            Assert.IsTrue(s == "StoneId = 1 and ProducerId = 2 and StoneLength = 3 and StoneWidth = 4 and StoneHeight = 5");
        }

        [TestMethod]
        public void CreateFilterStringTest2()
        {
            Filter filter = new Filter();
            filter.StoneId = 1;
            filter.ProducerId = null;
            filter.Length = null;
            filter.Width = null;
            filter.Height = null;

            string s = filter.CreateFilterString();

            Assert.IsTrue(s == "StoneId = 1");
        }

        [TestMethod]
        public void CreateFilterStringTest3()
        {
            Filter filter = new Filter();
            filter.StoneId = null;
            filter.ProducerId = null;
            filter.Length = null;
            filter.Width = null;
            filter.Height = null;

            string s = filter.CreateFilterString();

            Assert.IsTrue(s == "");
        }

        [TestMethod]
        public void CreateFilterStringTest4()
        {
            Filter filter = new Filter();
            filter.StoneId = 1;
            filter.ProducerId = null;
            filter.Length = 3;
            filter.Width = null;
            filter.Height = null;

            string s = filter.CreateFilterString();

            Assert.IsTrue(s == "StoneId = 1 and StoneLength = 3");
        }

        [TestMethod]
        public void CreateFilterStringTest5()
        {
            Filter filter = new Filter();
            filter.StoneId = null;
            filter.ProducerId = 2;
            filter.Length = null;
            filter.Width = null;
            filter.Height = null;

            string s = filter.CreateFilterString();

            Assert.IsTrue(s == "ProducerId = 2");
        }

    }
}
